package com.eh.message;

import com.eh.base.EndPoint;
import org.apache.commons.lang.SerializationUtils;

import java.io.IOException;
import java.io.Serializable;

/**
 * Created by David Li on 2016/5/17.
 */
public class MessageProducer extends EndPoint {
    public MessageProducer(String endPointName) {
        super(endPointName);
    }

    public void sendMessage(Serializable object) {
        try {
            channel.basicPublish("", endPointName, null, SerializationUtils.serialize(object));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
